<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
	<title>权限管理</title>
	
	<script>
		$(document).ready(function() {
			//聚焦第一个输入框
			$("#permission_showname").focus();
			//为inputForm注册validate函数
			$("#inputForm").validate();
		});
	</script>
</head>

<body>
<section class="content">
<div class="row">
		<div class="col-md-12">

			<!-- Primary box -->
			<div class="box box-solid box-primary">
				<div class="box-header">
					<i class="fa fa-edit"></i>
					<h3 class="box-title">管理权限</h3>
					<div class="box-tools pull-right">
						<button class="btn btn-primary btn-sm" data-widget="collapse">
							<i class="fa fa-minus"></i>
						</button>
					</div>
				</div>
				<div class="box-body">
	<form id="inputForm" action="${ctx}/permission/${action}" method="post" class="form-horizontal">
		<input type="hidden" name="id" value="${permission.id}"/>
		<fieldset>
			<div class="form-group">
				<label for="permission_function" class="col-sm-3 control-label">选择功能:</label>
				<div class="col-sm-6">
					<select id="permission_function" name="function.id" class="form-control">
						<c:forEach items="${functions}" var="function">
							<option value="${function.id}" <c:if test="${not empty permission.function and permission.function.id eq function.id }">selected="selected"</c:if>>${function.showname}</option>
						</c:forEach>
					</select>
				</div>
			</div>	
			<div class="form-group">
				<label for="permission_shownam" class="col-sm-3 control-label">显示名称:</label>
				<div class="col-sm-6">
					<input type="text" id="permission_showname" name="showname"  value="${permission.showname}" class="form-control input-large required" minlength="3"/>
				</div>
			</div>	
			<div class="form-group">
				<label for="permission_urlprefix" class="col-sm-3 control-label">URL前缀:</label>
				<div class="col-sm-6">
					<input type="text" id="permission_urlprefix" name="urlprefix"  value="${permission.urlprefix}" class="form-control input-large required" minlength="3"/>
				</div>
			</div>	
			<div class="form-group">
				<label for="permission_viewurl" class="col-sm-3 control-label">规则代码:</label>
				<div class="col-sm-6">
					<input type="text" id="permission_regulation" name="regulation"  value="${permission.regulation}" class="form-control input-large required" minlength="3"/>
				</div>
			</div>	
			<div class="form-group">
				<label for="permission_status" class="col-sm-3 control-label">状态:</label>
				<div class="col-sm-6">
					<select id="permission_status" name="status" class="form-control">
						<option value="1" <c:if test="${permission.status eq '1'}">selected="selected"</c:if>>有效</option>
						<option value="0" <c:if test="${permission.status eq '0'}">selected="selected"</c:if>>无效</option>
					</select>
				</div>
			</div>	
			<!--<div class="form-group">
				<label for="description" class="col-sm-3 control-label">任务描述:</label>
				<div class="col-sm-6">
					<textarea id="description" name="description" class="form-control input-large">${task.description}</textarea>
				</div>
			</div>	
			--><div class="modal-footer bg-gray">
				<input id="submit_btn" class="btn btn-primary" type="submit" value="提交"/>&nbsp;	
				<input id="cancel_btn" class="btn" type="button" value="返回" onclick="history.back()"/>
			</div>
		</fieldset>
	</form>
	</div>
	</div>
	</div>
	</div>
	</section>
</body>
</html>
